package com.ibeeking.found.common.config.feign;

import com.ibeeking.found.common.config.feign.fallback.MsgFeignClientFallbackFactory;
import com.ibeeking.found.common.entity.msg.MsgTemplateParam;
import com.ibeeking.found.common.entity.msg.MsgSimpleParam;
import com.ibeeking.nematos.utils.result.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Author ibeeking
 */
@FeignClient(name = "base-msg-server", contextId = "msgFeignClient", path = "/msg", fallbackFactory = MsgFeignClientFallbackFactory.class, decode404 = true)
public interface MsgFeignClient {

    /**
     * 发送内容消息
     *
     * @param param
     * @return
     */
    @PostMapping(value = "/send/feign/v1/sendSimpleMessage")
    ResponseResult<Boolean> sendSimpleMessage(@RequestBody MsgSimpleParam param);

    /**
     * 发送模板消息
     *
     * @param param
     * @return
     */
    @PostMapping(value = "/send/feign/v1/sendTemplateMessage")
    ResponseResult<Boolean> sendTemplateMessage(@RequestBody MsgTemplateParam param);

    /**
     * 查询验证码
     *
     * @param key
     * @param mobile
     * @return
     */
    @PostMapping(value = "/verificationCode/feign/v1/loginCheck/{key}/{mobile}")
    ResponseResult<String> queryVerificationCode(@PathVariable("key") String key, @PathVariable("mobile") String mobile);

    /**
     * 清空验证码
     *
     * @param key
     * @param mobile
     * @return
     */
    @PostMapping(value = "/verificationCode/feign/v1/clearVerificationCode/{key}/{mobile}")
    ResponseResult<Boolean> clearVerificationCode(@PathVariable("key") String key, @PathVariable("mobile") String mobile);

    /**
     * 校验验证码
     *
     * @param key
     * @param mobile
     * @param code
     * @return
     */
    @PostMapping(value = "/verificationCode/feign/v1/checkVerificationCode/{key}/{mobile}/{code}")
    ResponseResult<Boolean> checkVerificationCode(@PathVariable("key") String key, @PathVariable("mobile") String mobile, @PathVariable("code") String code);
}
